import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * ClassName: HomeworkThree
 * Description:
 * date: 2022/9/12 20:51
 *
 * @author 吴杰
 * @since JDK 1.8.0_31
 */
public class HomeworkThree {
    private int[] num=new int[20002];
    private int[] sushu=new int[8000];
    private int numSu=0;//记录素数个数

    public void init(){
        for(int i=2;i<=20000;i++){
            if(num[i] != 1)
            {
                sushu[++numSu]=i;
                for(int j=i*i;j<=20000;j+=i){
                    num[j]=1;
                }
            }
        }
    }


    public static void main(String[] args) {
        HomeworkThree homeworkThree=new HomeworkThree();
        homeworkThree.init();
        for(int i=1;i<=homeworkThree.numSu;i++){

            if(i%5==0) System.out.println(homeworkThree.sushu[i-1]);
            else System.out.print(homeworkThree.sushu[i-1]+" ");

        }
    }
}
